<template>
<el-form :model="editForm"  label-width="120px" :rules="editFormRules" ref="editFormRef">
    <el-form-item label="银行名称" prop="bankName">
        <el-input  v-model="editForm.bankName" placeholder="银行名称" :maxlength="255" @change="editSomeFields(editForm,'bankName',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="银行机构码" prop="bankCode">
        <el-input  v-model="editForm.bankCode" placeholder="银行机构码" :maxlength="255" @change="editSomeFields(editForm,'bankCode',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="银行卡账户编号" prop="cardAccountId">
        <el-input  v-model="editForm.cardAccountId" placeholder="银行卡账户编号" :maxlength="50" @change="editSomeFields(editForm,'cardAccountId',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="银行卡账户名称" prop="cardAccountName">
        <el-input  v-model="editForm.cardAccountName" placeholder="银行卡账户名称" :maxlength="255" @change="editSomeFields(editForm,'cardAccountName',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="银行分支机构名称" prop="subBankName">
        <el-input  v-model="editForm.subBankName" placeholder="银行分支机构名称" :maxlength="255" @change="editSomeFields(editForm,'subBankName',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="分支机构编码" prop="subBankCode">
        <el-input  v-model="editForm.subBankCode" placeholder="分支机构编码" :maxlength="50" @change="editSomeFields(editForm,'subBankCode',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="新增时间" prop="ctime">
        <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.ctime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" @change="editSomeFields(editForm,'ctime',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="更新时间" prop="ltime">
        <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.ltime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" @change="editSomeFields(editForm,'ltime',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="操作用户编号" prop="opUserid">
        <el-input  v-model="editForm.opUserid" placeholder="操作用户编号" :maxlength="50" @change="editSomeFields(editForm,'opUserid',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="操作用户名称" prop="opUsername">
        <el-input  v-model="editForm.opUsername" placeholder="操作用户名称" :maxlength="255" @change="editSomeFields(editForm,'opUsername',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="账户状态0无效1有效" prop="status">
        <el-input  v-model="editForm.status" placeholder="账户状态0无效1有效" :maxlength="1" @change="editSomeFields(editForm,'status',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="账户性质0-平台收款" prop="type">
        <el-input  v-model="editForm.type" placeholder="账户性质0-平台收款" :maxlength="1" @change="editSomeFields(editForm,'type',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="平台编号" prop="platformId">
        <el-input  v-model="editForm.platformId" placeholder="平台编号" :maxlength="50" @change="editSomeFields(editForm,'platformId',$event)" :disabled="disField"/>
    </el-form-item>
    <el-form-item label="银行logo图片" prop="bankImgUrl">
        <el-input  v-model="editForm.bankImgUrl" placeholder="银行logo图片" :maxlength="255" @change="editSomeFields(editForm,'bankImgUrl',$event)" :disabled="disField"/>
    </el-form-item>
</el-form>
<el-row v-if="showBtn!==false" class="footer">
    <el-button @click="close" icon="close">关闭</el-button>
    <el-button icon="submit" v-if="currOpType=='add'|| (currOpType=='edit' && someOpen==false)" v-loading="load.edit" type="primary" @click="saveSubmit" :disabled="disBtn('addBtn') || !checkBtnQx('addBtn',menuDefId) || load.edit">提交</el-button>
</el-row>
</template>

<script>
import * as BankAccountApi from '@/api/mdp/plat/bankAccount';
import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin.js';
import { mapState } from 'pinia'
import { useUserStore } from '@/store/modules/user'

export default {
    name:'BankAccountForm',
    mixins:[MdpFormMixin],
    components: {
    },
    computed: {
        ...mapState(useUserStore,['userInfo'])
    },
    props:{
    },
    watch: {
    },
    data() {
        return {
            menuDefId:'',//menu_def.id 菜单表菜单编号，用于按钮权限判断
            pkNames:["cardAccountId", "platformId"],//表格主键的java属性名称，驼峰命名，默认为id,支持多主键
            currOpType:'add',//表单 add、edit，所有按钮可动、detail-只看不能操作
            editFormRules: {
                cardAccountId:[
                //{ required: true, message: '此项必填', trigger: 'change' },
                //{ min: 1,max: 200, message: '长度在1到200之间', trigger: 'change'}
                ],
                platformId:[
                //{ required: true, message: '此项必填', trigger: 'change' },
                //{ min: 1,max: 200, message: '长度在1到200之间', trigger: 'change'}
                ]
            },
            editForm: {
                bankName:'',bankCode:'',cardAccountId:'',cardAccountName:'',subBankName:'',subBankCode:'',ctime:'',ltime:'',opUserid:'',opUsername:'',status:'',type:'',platformId:'',bankImgUrl:''
            },
            //增删改查(含批量)接口
            apis:{
                queryById: BankAccountApi.queryBankAccountById,
                add: BankAccountApi.addBankAccount,
                edit: BankAccountApi.editBankAccount,
                editSomeFields: BankAccountApi.editSomeFieldsBankAccount
            },
        }
    },
    methods: {
         //由组件扩展添加其它的初始页面的逻辑(mounted+onOpen都会调用此函数，建议只添加公共逻辑)
         initCurrData(){

         },
        /**
         * 检查参数是否满足调用后台接口的条件
         * @returns true / false
         */
        preParamCheck(params){
            return true;
        },
        /**
         * 对修改的字段进行判断，返回false ,将取消更新数据库,由组件扩展
         * @param {*} row 当前选中的行
         * @param {*} fieldName 修改的字段名
         * @param {*} $event 修改后的值
         * @param {*} params 将要提交服务器的参数
         * @returns true/false 返回false ,将取消更新数据库
         */
        editSomeFieldsCheck(row,fieldName,$event,params){
            if(this.editable==false){
                return false;
            }
            params[fieldName]=$event
            return true;
        },
    },
    mounted() {

    }
}

</script>

<style scoped>

</style>